<div class="resource-details">
  <div class="row">
    <div class="col-lg-6">
      <h3>
        Status
        <small ng-if="pod | debugLabel">
          debugging
          <a ng-href="{{pod | debugLabel | navigateResourceURL : 'Pod' : pod.metadata.namespace}}">{{pod | debugLabel}}</a>
        </small>
      </h3>
      <dl class="dl-horizontal left">
        <dt>Status:</dt>
        <dd>
          <status-icon status="pod | podStatus"></status-icon>
          {{pod | podStatus | sentenceCase}}
          <span ng-if="pod.metadata.deletionTimestamp">(expires {{pod.metadata.deletionTimestamp | date : 'medium'}})</span>
        </dd>
        <dt ng-if-start="pod.metadata.deletionTimestamp && pod.spec.terminationGracePeriodSeconds">Grace Period:</dt>
        <dd ng-if-end>
          <!-- Don't show "a few seconds" for small values. -->
          <span ng-if="pod.spec.terminationGracePeriodSeconds < 60">
            {{pod.spec.terminationGracePeriodSeconds}} seconds
          </span>
          <span ng-if="pod.spec.terminationGracePeriodSeconds >= 60">
            {{pod.spec.terminationGracePeriodSeconds | humanizeDurationValue : 'seconds'}}
          </span>
        </dd>
        <dt ng-if-start="pod.status.message">Message:</dt>
        <dd ng-if-end>{{pod.status.message}}</dd>
        <dt>IP:</dt>
        <dd>{{pod.status.podIP || 'unknown'}}</dd>
        <dt>Node:</dt>
        <dd>{{pod.spec.nodeName || 'unknown'}} <span ng-if="pod.status.hostIP && pod.spec.nodeName != pod.status.hostIP">({{pod.status.hostIP}})</span></dd>
        <dt>Restart Policy:</dt>
        <dd>{{pod.spec.restartPolicy || 'Always'}}</dd>
        <dt ng-if-start="pod.spec.activeDeadlineSeconds">Active Deadline:</dt>
        <dd ng-if-end>
          <!-- Don't show "a few seconds" for small values. -->
          <span ng-if="pod.spec.activeDeadlineSeconds < 60">
            {{pod.spec.activeDeadlineSeconds}} seconds
          </span>
          <span ng-if="pod.spec.activeDeadlineSeconds >= 60">
            {{pod.spec.activeDeadlineSeconds | humanizeDurationValue : 'seconds'}}
          </span>
          <span ng-if="pod.status.phase === 'Running' && pod.status.startTime" class="text-muted">
            (<duration-until-now timestamp="pod.status.startTime"></duration-until-now> elapsed)
          </span>
        </dd>
      </dl>
      <div ng-repeat="containerStatus in pod.status.containerStatuses | orderBy:'name'" >
        <h4>Container {{containerStatus.name}}</h4>
        <dl class="dl-horizontal left">
          <dt>State:</dt>
          <dd>
            <kubernetes-object-describe-container-state container-state="containerStatus.state"></kubernetes-object-describe-container-state>
          </dd>
          <dt ng-if="!(containerStatus.lastState | isEmptyObj)">Last State</dt>
          <dd ng-if="!(containerStatus.lastState | isEmptyObj)">
            <kubernetes-object-describe-container-state container-state="containerStatus.lastState"></kubernetes-object-describe-container-state>
          </dd>
          <dt>Ready:</dt>
          <dd>{{containerStatus.ready}}</dd>
          <dt>Restart Count:</dt>
          <dd>{{containerStatus.restartCount}}</dd>
          <div ng-if="(!containerStatus.state.running || !containerStatus.ready) && !(pod | debugLabel) && ('pods' | canI : 'create')" class="debug-pod-action">
            <a href="" ng-click="debugTerminal(containerStatus.name)" role="button">Debug in terminal</a>
          </div>
        </dl>
      </div>
    </div>
    <div class="col-lg-6">
      <h3>Template</h3>
      <pod-template
        pod-template="pod"
        images-by-docker-reference="imagesByDockerReference"
        builds="builds"
        detailed="true">
      </pod-template>
      <div ng-if="pod.spec.volumes.length">
        <h4>Volumes</h4>
        <p ng-if="(pod | annotation:'deploymentConfig') && !pod.spec.volumes.length">
          <a ng-href="project/{{project.metadata.name}}/attach-pvc?deploymentconfig={{pod | annotation:'deploymentConfig'}}">Attach storage and redeploy</a>
        </p>
        <volumes volumes="pod.spec.volumes" namespace="project.metadata.name"></volumes>
      </div>
    </div>
  </div>
  <annotations annotations="pod.metadata.annotations"></annotations>
</div>
